import React, { Component } from 'react'

export default class Old extends Component {
  constructor () {
    super()

    console.log('---Old---constructor---')

    this.state = {
      name: '张文清'
    }
  }

  componentWillMount () {
    console.log('---Old---componentWillMount---')
  }

  render () {
    console.log('---Old---render---')
    return (
      <div>
        Old
        <p>name is {this.state.name}</p>
        <p>count is {this.props.count}</p>
        <p>
          <button onClick={() => this.setState({ name: '黄日汉' })}>
            change
          </button>
        </p>
      </div>
    )
  }

  componentDidMount () {
    console.log('---Old---componentDidMount')
  }

  componentWillReceiveProps (props) {
    console.log('--Old--componentWillReceiveProps---', props)
  }

  shouldComponentUpdate () {
    console.log('---Old---shouldComponentUpdate')
    return true
  }

  componentWillUpdate () {
    console.log('---Old---componentWillUpdate')
  }

  componentDidUpdate () {
    console.log('---Old---componentDidUpdate')
  }

  componentWillUnmount () {
    console.log('---Old---componentWillUnmount')
  }
}
